<template>
  <div>
      <van-nav-bar
      title="不凡"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <input placeholder="姓名" v-model="data.name">
    <input placeholder="手机号码" v-model="data.mobile" >
    <input placeholder="省份" v-model="data.address">
    <input placeholder="城市" v-model="data.address_detail">
    <van-checkbox shape="square" v-model="data.checked" checked-color="#B4282D">是否设为默认地址</van-checkbox>

    <router-link to="/my/address"><div class="bc" @click="add">保存</div></router-link>
      
  </div>
</template>

<script>
import {saveaction} from '@/api/address/index.js'
export default {
    data(){
        return{
            data:{
            name:'',
            mobile:'',
            address:'',
            address_detail:'',
            },
            checked:false
        }
    },
    methods:{
         onClickLeft() {
            this.$router.go(-1)
        },
        add(){
            saveaction({
            address:this.data.address,
            addressId:'',
            checked:false,
            detailadress:this.data.address_detail,
            openId:'oQmbb4sNZdxaUQZ0sfYgvtOP2S7c',
            telNumber:this.data.mobile,
            userName:this.data.name

        })
        }
        
    },

}
</script>

<style>
input{
    width: 355px;
    height: 50px;
    border: 1px solid white;
    border-bottom: grey;
}
.bc{
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 50px;
    background-color: #B4282D;
    color: white;
    font-size: 14px;
    line-height: 50px;
}

</style>